<?php

namespace App\Providers;

use App\Http\Controllers\Auth\PasswordController;
use App\Http\Controllers\Resources\RoleController;
use App\Services\ServiceFactory;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        (new \App\Plugins\Shh\Route\Web())->register();
        (new \App\Plugins\Shh\Route\App())->register();
    }

    public function map() {

    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app
            ->when(\App\Http\Controllers\Resources\UserController::class)
            ->needs('$_resource')
            ->give('user');
        $this->app
            ->when(\App\Http\Controllers\Resources\GroupController::class)
            ->needs('$_resource')
            ->give('group');
        $this->app
            ->when(\App\Http\Controllers\Resources\AcceptRecordController::class)
            ->needs('$_resource')
            ->give('acceptRecord');
        $this->app
            ->when(\App\Http\Controllers\Resources\ProjectController::class)
            ->needs('$_resource')
            ->give('project');
        $this->app
            ->when(\App\Http\Controllers\Resources\CustomerController::class)
            ->needs('$_resource')
            ->give('customer');
        $this->app
            ->when(\App\Http\Controllers\Resources\RoleController::class)
            ->needs('$_resource')
            ->give('role');
        $this->app
            ->when(\App\Http\Controllers\Resources\TagController::class)
            ->needs('$_resource')
            ->give('tag');
        $this->app
            ->when(\App\Http\Controllers\Auth\PasswordController::class)
            ->needs('$_resource')
            ->give('user');
        $this->app->singleton('App\Plugin', function() {
            return null;
        });
    }
}
